function zoomed_image = autozoom(I,normsh,nnsh)
    [x newimage] = bc(I,normsh,nnsh);
    x = 1 - x;
    y = zeros(size(x));

    %% removing the noise
    x = bwareaopen(x,100);

    %% clear border
    x = imclearborder(x,4);

    %% fill the holes
    x = imfill(x,'holes');

    %% Perform connected component
    CC = bwconncomp(x);
    numPixels = cellfun(@numel,CC.PixelIdxList);
    [~,idx] = max(numPixels);
    y(CC.PixelIdxList{idx}) = 1;
    
    %% Crop the image
    [r,c] = find(y > 0);
    minx = min(c);
    maxx = max(c);
    miny = min(r);
    maxy = max(r);
    
    minx = minx - 60;
    miny = miny - 40;
    maxx = maxx + 60;
    maxy = maxy + 40;
    
    bb = [minx miny maxx-minx maxy-miny];
    zoomed_image = imcrop(newimage,bb);
end